<?php
	require("DataHelper.php");
	class TaiKhoan
	{
		public $tk_username;
		public $tk_password;
		public $tk_ngay_tao;
		public $tk_email;
		public $tk_ho_ten;
		public $tk_gioi_tinh;
		public $tk_dia_chi;
		public $tk_dien_thoai;
		public $tk_avatar;
		public $tk_tinh_trang;
		public $tk_loai;
		
		public static function ThemTaiKhoan($taikhoan)
		{
			$str = $taikhoan->$tk_password . $taikhoan->$tk_username;
			$taikhoan->$tk_password = md5($str);
			$query = "insert into Tai_Khoan(tk_username, tk_password, tk_ngay_tao, tk_email, tk_ho_ten, tk_gioi_tinh, tk_dien_thoai, tk_avatar, tk_tinh_trang) values ('$taikhoan->tk_username', '$taikhoan->tk_password', '$taikhoan->tk_ho_ten','$taikhoan->tk_gioi_tinh', $taikhoan->tk_dien_thoai, $taikhoan->tk_avatar, '$taikhoan->tk_tinh_trang')";
			QuerySQL($query);
			StopConnection();
		}
		
		public static function KiemTraUserName($Username)
		{
			$query = "select * from tai_khoan where tk_username = '$Username'";
			$results = QuerySQL($query);
			$rows = mysql_num_rows($results);
			if($rows)
				return false;
			return true;
		}
		 
	}
?>